﻿using Sys.Common;
using Sys.Core.Tour;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ScenicHist : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public string GetHist()
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();

        HttpCookie cookie = Request.Cookies["Scenic"];

        if (cookie != null)
        {
            string cookies = Request.Cookies["Scenic"].Value;

            var list = ScenicBll.I.Entities.Where(m => cookies.Contains(m.ID));

            sb.Append("<ul>");

            foreach (var str in cookies.Split(','))
            {
                foreach (var item in list)
                {
                    if (str.Equals(item.ID))
                    {
                        sb.Append("<li>");
                        sb.Append("<a href='Scenic.aspx?ID=" + item.ID + "'>");
                        sb.Append("<span class='pic'><img src='userfiles/scenic/home/" + item.Img + "' /></span>");
                        sb.Append("<span class='holist'>" + item.Name + "</span> ");
                        sb.Append("<span class='txt'>" + StringHelper.CutString(StringHelper.NoHTML(item.Content), 50) + "</span>");
                        sb.Append("</a>");
                        sb.Append("</li>"); break;
                    }
                }
            }

            sb.Append("</ul>");
        }

        return sb.ToString();
    }
}